<!DOCTYPE html>
<html>
<head>
    {include file="_Fragment/meta" /}
    <link rel="stylesheet" href="/static/pear/component/pear/css/pear.css" />
</head>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <table id="user-table" lay-filter="user-table"></table>
    </div>
</div>
{include file="_Fragment/javascript" /}
<script>
    layui.use(['table', 'form', 'jquery',], function() {
        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let id = "{$id}";
        let cols = [
            [
                {
                    title: 'ID',
                    field: 'id',
                    align: 'center',
                },
                {
                    title: '回复内容',
                    field: 'content',
                    align: 'center',
                },
                {
                    title: '回复人',
                    field: 'username',
                    align: 'center',
                },
                {
                    title: '创建时间',
                    field: 'add_time2',
                    align: 'center',
                }
            ]
        ]

        table.render({
            elem: '#user-table',
            url: '/Topic/getReplyList?id='+id,
            page: false,
            cols: cols,
            //skin: 'line',
            toolbar: '#user-toolbar',
            defaultToolbar: [{
                title: '刷新',
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
            }, 'filter'],
        });

        table.on('toolbar(user-table)', function(obj) {
            if (obj.event === 'refresh') {
                window.refresh();
            }
        });

        window.refresh = function(param) {
            table.reload('user-table');
        }
    })
</script>
</body>
</html>
